import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/public/common/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/common/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/common/user/logout',
    method: 'post'
  })
}

/**
 * 普通用户分页查询
 */
export function getCommonUserByPage(params) {
  console.log(`请求当前页: ` + JSON.stringify(params));
  return request({
    url: '/common/c/user/page',
    method: 'get',
    params: { 
      pageNum: params.pageNum, 
      pageSize: params.pageSize,
      userId: params.userId,
      name: params.name
    }
  })
}

export function updateCommonUser(data) {
  return request({
    url: '/common/c/user/update',
    method: 'post',
    data
  })
}